package com.dssingleton;

import java.io.*;

public class Main3 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        EnumClass instance = EnumClass.INSTANCE;
        System.out.println("instance = " + instance);
//        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("/test_workspace", "EnumClass.java")));
//        oos.writeObject(instance);
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("/test_workspace", "EnumClass.java")));
//        Object o = ois.readObject();
//        System.out.println("o = " + o);
        EnumClass instance2 = (EnumClass) ois.readObject();
        System.out.println("instance2 = " + instance2);
        System.out.println(instance == instance2);
    }
}
